package com.xiang.springboot.demo.httpsession.module1.config;

import com.xiang.springboot.demo.httpsession.module1.listener.HttpSessionListenerOfRedis;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

import javax.servlet.http.HttpSessionListener;

@Configuration
//maxInactiveIntervalInSeconds 默认是1800秒过期，这里测试修改为60秒
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 60)
public class RedisHttpSessionConfig {
    @Bean
    public HttpSessionListener httpSessionListener() {
        return new HttpSessionListenerOfRedis();
    }
}
